#ifndef __TIMER_H__
#define __TIMER_H__

#include "common.h"

#define Delay_TimeCounter 500
#define Count_Timer_Max 30


typedef struct _timer {
  uint8_t isStart;     //是否启动 1：启动 0：关闭
  uint8_t isOverflow;    //是否溢出 1：溢出 0：未溢出
  uint32_t time;          //
  uint32_t interval;
  int loop;
  void* param;
  void (* timerFunction)(void * pointer);
} timer;

typedef struct _time_container{
	timer timers[Count_Timer_Max];
}time_container ; 

void* timer_thread(void* param);
timer* timer_start(void (*timerFunction)(void * pointer), int32_t timeInterval,void* param,int loop);
void exec_timer_func(timer* p_timer);
int is_timer_started(timer* timer);
void timer_reset(timer* timer);
void timer_stop(timer* timer);
#endif // !__TIMER_H__
